import request from '@/utils/request'
import { fetchNoMsg } from '@/utils/fetch'
export function loginByUsername(account, psd) {
  const data = {
    account,
    psd
  }
  return request({
    url: '/admin-user/login/admin',
    method: 'post',
    data
  })
}

// export function loginByUsername (data) {
//   return fetchToken({
//     url: '/admin-user/login/admin',
//     method: 'post',
//     params: data
//   })
// }


export function logout() {
  return request({
    url: '/admin-user/logout',
    method: 'post'
  })
}

/* ============获取用户名============*/
export function getUserName(data) {
  return fetchNoMsg({
    url: '/admin-user/login/admin',
    method: 'post',
    data
  })
}

export function getMenu(data) {
  return fetchNoMsg({
    url: '/admin-user/me/allMenus',
    method: 'get',
    params: data
  })
}

export function getResource(data) {
  return fetchNoMsg({
    url: '/admin-user/me/allResources',
    method: 'get',
    params: data
  })
}
/*export function getUserInfo(token) {
  return request({
    url: '/user/info',
    method: 'get',
    params: { token }
  })
}*/

